import React from "react";
import { List } from "antd";
import { CollectItem } from "@/apis/shared.ts";

interface Props {
  collectItem: CollectItem[];
}

const UserCollectionItem: React.FC<Props> = ({ collectItem }) => {
  return (
    <div>
      {collectItem.length === 0 ? (
        <div>暂无文章</div>
      ) : (
        <List
          size="small"
          bordered
          dataSource={collectItem.length > 0 ? collectItem : []}
          renderItem={(item) => (
            <List.Item key={item._id}>
              <List.Item.Meta
                title={
                  <a href={`/layout/article?_id=${item._id}`}>{item.title}</a>
                }
                description={item.summary}
              />
            </List.Item>
          )}
        />
      )}
    </div>
  );
};

export default UserCollectionItem;
